Skip to content

Conversation

workingjubilee
Copy link
Member

At some point "BareFn" was the chosen name for a "bare" function, without the niceties of ~fn, &fn, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax.

However, we never changed the internal name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.

@rustbot
Copy link
Collaborator

rustbot commented Jul 6, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 6, 2025

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

HIR ty lowering was modified

cc @fmease

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jul 6, 2025
@fmease
Copy link
Member

fmease commented Jul 6, 2025

r=me with nit addressed and some commit squashing (personally speaking I would've probably named the locals fn_ptr_ty not fn_ptr but I bet not everyone would agree)

@bors rollup

@fmease fmease assigned fmease and unassigned SparrowLii Jul 6, 2025
workingjubilee and others added 4 commits July 6, 2025 15:03
Fix some comments and related types and locals where it is obvious, e.g.
- bare_fn -> fn_ptr
- LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType

Co-authored-by: León Orell Valerian Liehr <[email protected]>
@workingjubilee
Copy link
Member Author

Added a few other comment fixups: 06c463b

I preserved the tools changes as separate commits to make it easier to navigate those histories, while crushing the compiler ones.

@workingjubilee
Copy link
Member Author

@bors r=fmease

@bors
Copy link
Collaborator

bors commented Jul 6, 2025

📌 Commit 3c9b986 has been approved by fmease

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 6, 2025
bors added a commit that referenced this pull request Jul 7, 2025
Rollup of 9 pull requests

Successful merges:

 - #143206 (Align attr fixes)
 - #143236 (Stabilize `mixed_integer_ops_unsigned_sub`)
 - #143344 (Port `#[path]` to the new attribute parsing infrastructure )
 - #143359 (Link to 2024 edition page for `!` fallback changes)
 - #143456 (mbe: Change `unused_macro_rules` to a `DenseBitSet`)
 - #143529 (Renamed retain_mut to retain on LinkedList as mentioned in the ACP)
 - #143535 (Remove duplicate word)
 - #143544 (compiler: rename BareFn to FnPtr)
 - #143552 (lib: more eagerly return `self.len()` from `ceil_char_boundary`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7eea141 into rust-lang:master Jul 7, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 7, 2025
rust-timer added a commit that referenced this pull request Jul 7, 2025
Rollup merge of #143544 - workingjubilee:rename-bare-fn, r=fmease

compiler: rename BareFn to FnPtr

At some point "BareFn" was the chosen name for a "bare" function, without the niceties of `~fn`, `&fn`, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax.

However, we never changed the *internal* name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.
@workingjubilee workingjubilee deleted the rename-bare-fn branch July 7, 2025 07:08
github-actions bot pushed a commit to devnexen/miri that referenced this pull request Jul 8, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143206 (Align attr fixes)
 - rust-lang/rust#143236 (Stabilize `mixed_integer_ops_unsigned_sub`)
 - rust-lang/rust#143344 (Port `#[path]` to the new attribute parsing infrastructure )
 - rust-lang/rust#143359 (Link to 2024 edition page for `!` fallback changes)
 - rust-lang/rust#143456 (mbe: Change `unused_macro_rules` to a `DenseBitSet`)
 - rust-lang/rust#143529 (Renamed retain_mut to retain on LinkedList as mentioned in the ACP)
 - rust-lang/rust#143535 (Remove duplicate word)
 - rust-lang/rust#143544 (compiler: rename BareFn to FnPtr)
 - rust-lang/rust#143552 (lib: more eagerly return `self.len()` from `ceil_char_boundary`)

r? `@ghost`
`@rustbot` modify labels: rollup
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 10, 2025
…mease

compiler: rename BareFn to FnPtr

At some point "BareFn" was the chosen name for a "bare" function, without the niceties of `~fn`, `&fn`, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax.

However, we never changed the *internal* name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jul 11, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#143206 (Align attr fixes)
 - rust-lang#143236 (Stabilize `mixed_integer_ops_unsigned_sub`)
 - rust-lang#143344 (Port `#[path]` to the new attribute parsing infrastructure )
 - rust-lang#143359 (Link to 2024 edition page for `!` fallback changes)
 - rust-lang#143456 (mbe: Change `unused_macro_rules` to a `DenseBitSet`)
 - rust-lang#143529 (Renamed retain_mut to retain on LinkedList as mentioned in the ACP)
 - rust-lang#143535 (Remove duplicate word)
 - rust-lang#143544 (compiler: rename BareFn to FnPtr)
 - rust-lang#143552 (lib: more eagerly return `self.len()` from `ceil_char_boundary`)

r? `@ghost`
`@rustbot` modify labels: rollup
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Jul 21, 2025
…mease

compiler: rename BareFn to FnPtr

At some point "BareFn" was the chosen name for a "bare" function, without the niceties of `~fn`, `&fn`, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax.

However, we never changed the *internal* name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants